package com.dao;

import com.classe.Danos;
import com.utils.TransacaoE2;
import java.util.ArrayList;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean
@RequestScoped
public class DanosDAO {

       /** Creates a new instance of DanosBean */
    public DanosDAO() {
       
    }
    
    public static void inserir(Danos d) {
        TransacaoE2 t = new TransacaoE2();
        t.begin();
        t.inserir(d);
        t.commit();
    }

    public static void deletar(Danos d) {
        TransacaoE2 t = new TransacaoE2();
        t.begin();
        t.deletar(d);
        t.commit();
    }
    
    public static void  alterar(Danos d){
        TransacaoE2 t = new TransacaoE2();
        t.begin();
        t.alterar(d);
        t.commit();
    }

    public static ArrayList<Danos> listar(String filtro) {
        TransacaoE2 t = new TransacaoE2();
        t.begin();
        ArrayList<Danos> mostra = t.mostrar(Danos.class, filtro);
        t.commit();
        return mostra;
    }
}
